new Vue({
    el: '.page-content',
    data: {
        title: "",
        totalPage: "",
        articleList: [],
        page: 1
    },
    methods: {
        findPage: function (page) {
            if (this.totalPage == 0) {
                this.totalPage = 1;
            }
            if (page < 1) {
                layer.msg("已经是第一页")
                return;
            }
            if (page > this.totalPage) {
                layer.msg("已经是最后一页")
                return;
            }
            axios({
                method: "get",
                url: `/article/findFavoritePage/${page}`,
                params: {title: this.title}
            }).then(res => {
                if (res.data.flag) {
                    this.totalPage = res.data.data.totalPage;
                    this.articleList = res.data.data.rows;
                    this.page = page;
                }
            });
        },
        toDetail: function (articleId) {
            sessionStorage.setItem("articleId", articleId);
            location.href = "article_detail.html";
        }
    },
    created: function () {
        this.findPage(1);
    }
})